import { getAliPay } from '@/api';
import { isMobileTerminal } from './flexible';

export async function alipay(title: string, desc: string, totalAmount: number) {
  const { encodeURI } = await getAliPay<{
    encodeURI: string;
  }>({
    subject: title,
    totalAmount,
    body: desc,
    isMobile: isMobileTerminal.value
  });

  window.location.href = decodeURIComponent(encodeURI);
}
